﻿

<link rel="stylesheet" type="text/css" href="/static/css/bootstrap.css">
<link rel="stylesheet" type="text/css" href="/static/css/bootstrap-responsive.css">
<link rel="stylesheet" type="text/css" href="/static/css/bootstrap-overrides.css">
<link rel="stylesheet" type="text/css" href="/static/css/lib/font-awesome.css">

<link rel="stylesheet" type="text/css" href="/static/css/layout.css">
<link rel="stylesheet" type="text/css" href="/static/css/elements.css">
<link rel="stylesheet" type="text/css" href="/static/css/icons.css">
<link rel="stylesheet" type="text/css" href="/static/css/css.css">
<link rel="stylesheet" type="text/css" href="/static/css/compiled/user-profile.css" media="screen" />

<script src="/static/js/jquery-1.8.3.min.js"></script>
<script src="/static/js/bootstrap.min.js"></script>
<script src="/static/js/theme.js"></script>
<script src="/static/js/layer/layer.js"></script>
<script src="/static/js/base.js"></script>

<style>
    .alert-msg {
        display: none;
        margin-left: 5px;
    }
</style>
<div class="container-fluid">
    <div id="pad-wrapper" class="form-page">

        <div class="row-fluid head">
            <div class="span12">
                <h4>添加建议反馈</h4>
            </div>
        </div>

        <div class="row-fluid withdraw">
            <form id="form_data">
                <div class="field-box withdrawApply">
                    <label>标题：</label>
                    <input class="span4" style="width:350px" type="text" id="Title" name="Title" placeholder="请输入标题" value="" /><span class="alert-msg"></span>
                </div>
                <div class="field-box withdrawApply">
                    <label>内容：</label>
                    <textarea id="Content" name="Content" style="width:350px" rows="5"></textarea><span class="alert-msg"></span>
                </div>

                <div class="span11 field-box actions">
                    <label></label>
                    <input type="button" class="btn-glow primary" id="btn_submit" value="确认提交">
                </div>
            </form>
        </div>
    </div>
</div>

<script>

    function SetTips(id, meg) {
        $("#" + id).next("span").html('<i class="icon-remove-sign"></i>' + meg);
        $("#" + id).next("span").show();
        $("#" + id).focus();
    }

    $(function () {

        $("#btn_submit").click(function () {

            $(".alert-msg").css("display", "none");
            var data = validate.serializeObject($("#form_data"));

            if (validate.isNull(data.Title)) {
                SetTips('Title', "请输入标题");
                return;
            }
            

            if (validate.isNull(data.Content)) {
                SetTips('Content', "请输入内容");
                return;
            }
                       

            $.HM.ajax("FeedBack/AddFeedBackInfo", {
                data: data,
                type: "POST",
                dataType: 'json',
                success: function (d) {
                    if (d.IsSuccess) {
                        layer.msg("添加成功", { icon: 1 });
                        setTimeout(function () {
                            window.parent.location.reload();
                        }, 1500);

                    } else {
                        layer.msg(d.message, { icon: 0 });
                    }
                }
            });

        });

    });

</script>
